<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp">


    <f:metadata >
        <f:viewParam name="id" value="#{patientReportController.encryptedPatientReportId}" ></f:viewParam>
        <f:viewParam name="user" value="#{patientReportController.encryptedExpiary}" ></f:viewParam>
        <f:viewAction action="#{patientReportController.preparePatientReportByIdForRequests()}" ></f:viewAction>
    </f:metadata>
    <head>

    </head>

    <h:body>
        <ui:composition template="/resources/template/template_contents_only.xhtml">
            <ui:define name="content">
                <h:outputStylesheet library="css" name="lab.css" ></h:outputStylesheet>

                <h:panelGroup rendered="#{patientReportController.currentPatientReport eq null}"  >
                    <div style="text-align: center; top: 10%;">
                        <h1>No Such Report Found</h1>
                        <h2>The Report Link may have expired.</h2>
                    </div>
                </h:panelGroup>

                <h:panelGroup  layout="block" id="divPrint" 
                               style="text-align: center;padding: 1%; margin: 0 auto;" 
                               rendered="#{patientReportController.currentPatientReport ne null}"  >

                    <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType ne 'Microbiology'}"  >
                        <div id="divReport" style="position: absolute; height: 26cm; width: 18cm; margin: 0.1cm auto; border: 1px solid gray;">


                            <ez:common_report commonReportFormat="#{patientReportController.currentPatientReport.reportFormat}"
                                              patientReport="#{patientReportController.currentPatientReport}"/>


                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.lobValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false}"  escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.lobValue}" rendered="#{prv.investigationItem.ixItemType eq 'Template' and prv.investigationItem.retired eq false}"  escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Varchar'}" escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.doubleValue}"  rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Double' and prv.investigationItem.retired eq false}"   escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'DynamicLabel'}" escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Flag'}" escape="false" />
                                </div>
                            </ui:repeat>
                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                    <h:outputLabel value="#{prv.doubleValue}" rendered="#{prv.investigationItem.ixItemType eq 'Calculation' }" escape="false" >
                                        <f:convertNumber pattern="0.0" />
                                    </h:outputLabel>
                                </div>
                            </ui:repeat>
                            <ui:repeat value="#{patientReportController.currentPatientReport.item.reportItems}" var="myIi" >
                                <div style="#{myIi.cssStyle}; position:absolute;">
                                    <h:outputText rendered="#{myIi.retired ne true and myIi.ixItemType eq 'Label' }" value="#{myIi.htmltext}" style="color: #{myIi.cssColor}" escape="false" ></h:outputText>
                                </div>
                            </ui:repeat>
                        </div>
                    </h:panelGroup>
                    <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType eq 'Microbiology'}"  >
                        <div id="divReportM"   class="labReport" >
                            <ez:common_report commonReportFormat="#{patientReportController.currentPatientReport.reportFormat}"
                                              patientReport="#{patientReportController.currentPatientReport}"/>
                            <div style="position: absolute; top: 28%; width: 97%; left: 1%; text-align: center; font-family:Cambria, Georgia, serif; font-size: 16px; height: 70%; vertical-align: top;" >
                                <div id="ixName" >
                                    <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.printName}" 
                                                   style="font-weight: bold;font-size: 18px!important; "/>
                                </div>
                                <div id="labelsAndValues" style="left:5%; width: 90%; display: inline-block; vertical-align: top; " >
                                    <div style="vertical-align: top; width: 100%; padding: 1px;margin: auto;display: inline-block;">
                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <h:panelGroup style="display: inline-block; clear: left; float: left; width: 100%; vertical-align: top;" layout="block"  rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.riTop lt 50 }" >
                                                <div style="display: inline-block; float: left; width: 1%; clear: left; " ></div>
                                                <div style="display: inline-block; top: 0px; float: left; width: 20%; text-align: left; padding-top: 2%; padding-bottom: 1%; ">
                                                    <h:outputLabel value="#{prv.investigationItem.name}"   escape="false"/>
                                                </div>
                                                <div style="display: inline-block; float: left; width: 3%; " ></div>
                                                <div style="display: inline-block; text-align: left; float:left; width: 60%; padding-top: 2%; padding-bottom: 1%; ">
                                                    <h:outputLabel value="#{fn:replace(prv.lobValue,'\\n','&lt;br/&gt;')}"   escape="false"   />
                                                </div>
                                            </h:panelGroup>
                                        </ui:repeat>
                                    </div>

                                    <div style="vertical-align: top; text-align: left;  padding-top: 3%; padding-bottom: 2%; clear: left;">
                                        <h:outputLabel value="Antibiotic Sensitivity Test" 
                                                       rendered="#{patientReportController.currentPatientReport.transHasAbst}"
                                                       style="font-size: 120%; font-weight: bold; padding-left: 18px;"></h:outputLabel>
                                    </div>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" 
                                                var="prv" >
                                        <h:panelGroup 
                                            rendered="#{prv.investigationItem.ixItemType eq 'Antibiotic' and prv.investigationItem.retired eq false and prv.strValue ne '' and prv.strValue ne null  }" >
                                            <div style="float: left;width: 5%; clear: left;" ></div>
                                            <div style=" float: left; text-align: left; width: 40%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                            </div>
                                            <div style="float: left;width: 5%;  " ></div>
                                            <div style=" text-align: left; float:left;width: 40%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                <h:outputLabel value="#{prv.strValue}" escape="false" style="text-transform: uppercase;" />
                                            </div>

                                        </h:panelGroup>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <h:panelGroup rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.riTop gt 50 }" >
                                            <div style="float: left;width: 5%; " ></div>
                                            <div style=" float: left; text-align: left; width: 20%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                            </div>
                                            <div style="float: left;width: 5%;  " ></div>
                                            <div style=" text-align: left; float:left;width: 60%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                <h:outputLabel value="#{fn:replace(prv.lobValue,'\\n','&lt;br/&gt;')}"    escape="false" />
                                            </div>
                                        </h:panelGroup>
                                    </ui:repeat>
                                </div>
                                <div style="clear: left;padding-top: 2%;">
                                    <h:outputLabel value="--- End of Report ---" style="font-size: 14px; font-weight: bold; "></h:outputLabel>
                                </div>
                            </div>
                        </div>
                    </h:panelGroup>

                </h:panelGroup>

            </ui:define>

        </ui:composition>

    </h:body>
</html>
